// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.IndexManagement
{
	public sealed partial class SlowlogTresholdLevels
	{
		[JsonInclude]
		[JsonPropertyName("debug")]
		public Elastic.Clients.Elasticsearch.Duration? Debug { get; set; }

		[JsonInclude]
		[JsonPropertyName("info")]
		public Elastic.Clients.Elasticsearch.Duration? Info { get; set; }

		[JsonInclude]
		[JsonPropertyName("trace")]
		public Elastic.Clients.Elasticsearch.Duration? Trace { get; set; }

		[JsonInclude]
		[JsonPropertyName("warn")]
		public Elastic.Clients.Elasticsearch.Duration? Warn { get; set; }
	}

	public sealed partial class SlowlogTresholdLevelsDescriptor : SerializableDescriptorBase<SlowlogTresholdLevelsDescriptor>
	{
		internal SlowlogTresholdLevelsDescriptor(Action<SlowlogTresholdLevelsDescriptor> configure) => configure.Invoke(this);
		public SlowlogTresholdLevelsDescriptor() : base()
		{
		}

		private Elastic.Clients.Elasticsearch.Duration? DebugValue { get; set; }

		private Elastic.Clients.Elasticsearch.Duration? InfoValue { get; set; }

		private Elastic.Clients.Elasticsearch.Duration? TraceValue { get; set; }

		private Elastic.Clients.Elasticsearch.Duration? WarnValue { get; set; }

		public SlowlogTresholdLevelsDescriptor Debug(Elastic.Clients.Elasticsearch.Duration? debug)
		{
			DebugValue = debug;
			return Self;
		}

		public SlowlogTresholdLevelsDescriptor Info(Elastic.Clients.Elasticsearch.Duration? info)
		{
			InfoValue = info;
			return Self;
		}

		public SlowlogTresholdLevelsDescriptor Trace(Elastic.Clients.Elasticsearch.Duration? trace)
		{
			TraceValue = trace;
			return Self;
		}

		public SlowlogTresholdLevelsDescriptor Warn(Elastic.Clients.Elasticsearch.Duration? warn)
		{
			WarnValue = warn;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (DebugValue is not null)
			{
				writer.WritePropertyName("debug");
				JsonSerializer.Serialize(writer, DebugValue, options);
			}

			if (InfoValue is not null)
			{
				writer.WritePropertyName("info");
				JsonSerializer.Serialize(writer, InfoValue, options);
			}

			if (TraceValue is not null)
			{
				writer.WritePropertyName("trace");
				JsonSerializer.Serialize(writer, TraceValue, options);
			}

			if (WarnValue is not null)
			{
				writer.WritePropertyName("warn");
				JsonSerializer.Serialize(writer, WarnValue, options);
			}

			writer.WriteEndObject();
		}
	}
}